{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li class="active"><a href="">提现账户</a></li>
</ul>
<div class="app-content">
	<div class="app-form">
        <form action="" method="post" class="form-horizontal form form-validate">
            <div class="panel panel-default">
                <div class="panel-heading">提现账户</div>
                <div class="panel-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">收款方式</label>
                        <div class="col-sm-9">
                            {if $cashset}
                                {if $cashset['alipay']}
                                    <label class="radio-inline">
                                        <input type="radio" value="1" name="data[payment_type]" {if $a['payment_type'] == 1}checked{/if}/> 支付宝
                                    </label>
                                {/if}
                                {if $cashset['we_chat']}
                                    <label class="radio-inline">
                                        <input type="radio" value="2" name="data[payment_type]" {if $a['payment_type'] == 2}checked{/if}/> 微信
                                    </label>
                                {/if}
                                {if $cashset['bank_card']}
                                    <label class="radio-inline">
                                        <input type="radio" value="3" name="data[payment_type]" {if $a['payment_type'] == 3}checked{/if}/> 银行卡
                                    </label>
                                {/if}
                            {else}
                                <input type="text" readonly value="平台暂未开通任何打款方式！" class="form-control"/>
                            {/if}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">收款用户</label>
                        <div class="col-sm-9">
                            {php echo tpl_select_user('openid', $a['cashopenid']);}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-9">
                            <input type="text" name="realname" value="{$user['realname']}" class="form-control mustFill" placeholder="微信实名认证姓名"/>
                            <div class="help-block">请仔细填写账户信息，如果由于您填写错误导致资金流失，平台概不负责</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">开户行</label>
                        <div class="col-sm-9">
                            <input type="text" name="data[bank_name]" value="{$a['bank_name']}" maxlength="50" class="form-control mustFill" placeholder="请输入开户行"/>
                            <div class="help-block">请仔细填写账户信息，如果由于您填写错误导致资金流失，平台概不负责</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">开户人</label>
                        <div class="col-sm-9">
                            <input type="text" name="data[bank_username]" value="{$a['bank_username']}" maxlength="20" class="form-control mustFill" placeholder="请输入开户人的姓名"/>
                            <div class="help-block">请仔细填写账户信息，如果由于您填写错误导致资金流失，平台概不负责</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">银行卡账号</label>
                        <div class="col-sm-9">
                            <input type="text" name="data[card_number]" value="{$a['card_number']}" maxlength="20" class="form-control mustFill" placeholder="请输入银行卡账号"/>
                            <div class="help-block">请仔细填写账户信息，如果由于您填写错误导致资金流失，平台概不负责</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">支付宝账号</label>
                        <div class="col-sm-9">
                            <input type="text" name="data[alipay]" value="{$a['alipay']}" maxlength="20" class="form-control mustFill" placeholder="请输入支付宝账号"/>
                            <div class="help-block">请仔细填写账户信息，如果由于您填写错误导致资金流失，平台概不负责</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-9">
                            <input type="submit" name="submit" value="提交" class="btn btn-primary min-width" />
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        </div>
                    </div>
                </div>
            </div>
        </form>
	</div>
</div>
<script>
    /**
     * 进入页面调用一次必填判断
     */
    $(function () {
        changeContent();
    });
    /**
     * 改变收款方式时调用一次必填判断
     */
    $("[name='data[payment_type]']").on('change',function () {
        changeContent()
    });
    /**
     * 根据选中的内容来判断确定必须填写的内容
     */
    function changeContent() {
        var values = $("[name='data[payment_type]']:checked").val();
        $(".mustFill").attr("required",false);
        if(values == 1){
            $("[name='data[alipay]']").attr("required",true);
        }else if (values == 2){
            $("[name='realname']").attr("required",true);
        }else if (values == 3){
            $("[name='data[bank_name]']").attr("required",true);
            $("[name='data[card_number]']").attr("required",true);
        }
    }
</script>
{php include wl_template('common/footer');}